package com.yy.enums;

public enum TaskStatus {
    PENDING_CONFIGURATION(1, "待配置"),
    PENDING_SCHEDULE_RETRIEVAL(2, "待获取排班"),
    RETRIEVAL_FAILED(3, "获取失败"),
    PENDING_INITIATION(4, "待发起"),
    APPOINTMENT_SUCCESSFUL(5, "预约成功"),
    APPOINTMENT_FAILED(6, "无记录"),
    CANCELLED(7, "已取消");

    private final int code;
    private final String description;

    TaskStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static String getDescriptionByCode(int code) {
        for (TaskStatus status : TaskStatus.values()) {
            if (status.getCode() == code) {
                return status.getDescription();
            }
        }
        return null; // 或者抛出异常或返回默认值，取决于你的需求
    }
}

